// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "lowercase.h"
#include <vespa/vespalib/text/utf8.h>

namespace vespalib {

vespalib::string
LowerCase::convert(const vespalib::stringref& input)
{
    vespalib::string output;
    Utf8Reader r(input);
    Utf8Writer w(output);

    while (r.hasMore()) {
        uint32_t lower = r.getChar();
        uint32_t upper = convert(lower);
        w.putChar(upper);
    }
    return output;
}


/*
  NOTE: the tables below are generated from Java code to
  make sure they agree with Java's notion of lowercasing
  AND libyell's notions as well.  We may have to hack around
  to support more than one simultaneous locale later, but
  from reading JDK7 implementation this only matters for
  a very few languages.
*/

unsigned char
LowerCase::lowercase_0_block[256] = {
    0,      1,      2,      3,      4,      5,      6,      7,
    8,      9,      10,     11,     12,     13,     14,     15,
    16,     17,     18,     19,     20,     21,     22,     23,
    24,     25,     26,     27,     28,     29,     30,     31,
    32,     33,     34,     35,     36,     37,     38,     39,
    40,     41,     42,     43,     44,     45,     46,     47,
    48,     49,     50,     51,     52,     53,     54,     55,
    56,     57,     58,     59,     60,     61,     62,     63,
    64,     97,     98,     99,     100,    101,    102,    103,
    104,    105,    106,    107,    108,    109,    110,    111,
    112,    113,    114,    115,    116,    117,    118,    119,
    120,    121,    122,    91,     92,     93,     94,     95,
    96,     97,     98,     99,     100,    101,    102,    103,
    104,    105,    106,    107,    108,    109,    110,    111,
    112,    113,    114,    115,    116,    117,    118,    119,
    120,    121,    122,    123,    124,    125,    126,    127,
    128,    129,    130,    131,    132,    133,    134,    135,
    136,    137,    138,    139,    140,    141,    142,    143,
    144,    145,    146,    147,    148,    149,    150,    151,
    152,    153,    154,    155,    156,    157,    158,    159,
    160,    161,    162,    163,    164,    165,    166,    167,
    168,    169,    170,    171,    172,    173,    174,    175,
    176,    177,    178,    179,    180,    181,    182,    183,
    184,    185,    186,    187,    188,    189,    190,    191,
    224,    225,    226,    227,    228,    229,    230,    231,
    232,    233,    234,    235,    236,    237,    238,    239,
    240,    241,    242,    243,    244,    245,    246,    215,
    248,    249,    250,    251,    252,    253,    254,    223,
    224,    225,    226,    227,    228,    229,    230,    231,
    232,    233,    234,    235,    236,    237,    238,    239,
    240,    241,    242,    243,    244,    245,    246,    247,
    248,    249,    250,    251,    252,    253,    254,    255
};


uint32_t
LowerCase::lowercase_1_block[256] = {
    257,    257,    259,    259,    261,    261,    263,    263,
    265,    265,    267,    267,    269,    269,    271,    271,
    273,    273,    275,    275,    277,    277,    279,    279,
    281,    281,    283,    283,    285,    285,    287,    287,
    289,    289,    291,    291,    293,    293,    295,    295,
    297,    297,    299,    299,    301,    301,    303,    303,
    105,    305,    306,    307,    309,    309,    311,    311,
    312,    314,    314,    316,    316,    318,    318,    319,
    320,    322,    322,    324,    324,    326,    326,    328,
    328,    329,    331,    331,    333,    333,    335,    335,
    337,    337,    339,    339,    341,    341,    343,    343,
    345,    345,    347,    347,    349,    349,    351,    351,
    353,    353,    355,    355,    357,    357,    359,    359,
    361,    361,    363,    363,    365,    365,    367,    367,
    369,    369,    371,    371,    373,    373,    375,    375,
    255,    378,    378,    380,    380,    382,    382,    383,
    384,    595,    387,    387,    389,    389,    596,    392,
    392,    598,    599,    396,    396,    397,    477,    601,
    603,    402,    402,    608,    611,    405,    617,    616,
    409,    409,    410,    411,    623,    626,    414,    629,
    417,    417,    419,    419,    421,    421,    640,    424,
    424,    643,    426,    427,    429,    429,    648,    432,
    432,    650,    651,    436,    436,    438,    438,    658,
    441,    441,    442,    443,    445,    445,    446,    447,
    448,    449,    450,    451,    452,    453,    454,    455,
    456,    457,    458,    459,    460,    462,    462,    464,
    464,    466,    466,    468,    468,    470,    470,    472,
    472,    474,    474,    476,    476,    477,    479,    479,
    481,    481,    483,    483,    485,    485,    487,    487,
    489,    489,    491,    491,    493,    493,    495,    495,
    496,    497,    498,    499,    501,    501,    405,    447,
    505,    505,    507,    507,    509,    509,    511,    511
};


uint32_t
LowerCase::lowercase_2_block[256] = {
    513,    513,    515,    515,    517,    517,    519,    519,
    521,    521,    523,    523,    525,    525,    527,    527,
    529,    529,    531,    531,    533,    533,    535,    535,
    537,    537,    539,    539,    541,    541,    543,    543,
    414,    545,    547,    547,    549,    549,    551,    551,
    553,    553,    555,    555,    557,    557,    559,    559,
    561,    561,    563,    563,    564,    565,    566,    567,
    568,    569,    11365,  572,    572,    410,    11366,  575,
    576,    578,    578,    384,    649,    652,    583,    583,
    585,    585,    587,    587,    589,    589,    591,    591,
    592,    593,    594,    595,    596,    597,    598,    599,
    600,    601,    602,    603,    604,    605,    606,    607,
    608,    609,    610,    611,    612,    613,    614,    615,
    616,    617,    618,    619,    620,    621,    622,    623,
    624,    625,    626,    627,    628,    629,    630,    631,
    632,    633,    634,    635,    636,    637,    638,    639,
    640,    641,    642,    643,    644,    645,    646,    647,
    648,    649,    650,    651,    652,    653,    654,    655,
    656,    657,    658,    659,    660,    661,    662,    663,
    664,    665,    666,    667,    668,    669,    670,    671,
    672,    673,    674,    675,    676,    677,    678,    679,
    680,    681,    682,    683,    684,    685,    686,    687,
    688,    689,    690,    691,    692,    693,    694,    695,
    696,    697,    698,    699,    700,    701,    702,    703,
    704,    705,    706,    707,    708,    709,    710,    711,
    712,    713,    714,    715,    716,    717,    718,    719,
    720,    721,    722,    723,    724,    725,    726,    727,
    728,    729,    730,    731,    732,    733,    734,    735,
    736,    737,    738,    739,    740,    741,    742,    743,
    744,    745,    746,    747,    748,    749,    750,    751,
    752,    753,    754,    755,    756,    757,    758,    759,
    760,    761,    762,    763,    764,    765,    766,    767
};


uint32_t
LowerCase::lowercase_3_block[256] = {
    768,    769,    770,    771,    772,    773,    774,    775,
    776,    777,    778,    779,    780,    781,    782,    783,
    784,    785,    786,    787,    788,    789,    790,    791,
    792,    793,    794,    795,    796,    797,    798,    799,
    800,    801,    802,    803,    804,    805,    806,    807,
    808,    809,    810,    811,    812,    813,    814,    815,
    816,    817,    818,    819,    820,    821,    822,    823,
    824,    825,    826,    827,    828,    829,    830,    831,
    832,    833,    834,    835,    836,    837,    838,    839,
    840,    841,    842,    843,    844,    845,    846,    847,
    848,    849,    850,    851,    852,    853,    854,    855,
    856,    857,    858,    859,    860,    861,    862,    863,
    864,    865,    866,    867,    868,    869,    870,    871,
    872,    873,    874,    875,    876,    877,    878,    879,
    880,    881,    882,    883,    884,    885,    886,    887,
    888,    889,    890,    891,    892,    893,    894,    895,
    896,    897,    898,    899,    900,    901,    940,    903,
    941,    942,    943,    907,    972,    909,    973,    974,
    912,    945,    946,    947,    948,    949,    950,    951,
    952,    953,    954,    955,    956,    957,    958,    959,
    960,    961,    930,    963,    964,    965,    966,    967,
    968,    969,    970,    971,    940,    941,    942,    943,
    944,    945,    946,    947,    948,    949,    950,    951,
    952,    953,    954,    955,    956,    957,    958,    959,
    960,    961,    962,    963,    964,    965,    966,    967,
    968,    969,    970,    971,    972,    973,    974,    975,
    976,    977,    978,    979,    980,    981,    982,    983,
    985,    985,    987,    987,    989,    989,    991,    991,
    993,    993,    995,    995,    997,    997,    999,    999,
    1001,   1001,   1003,   1003,   1005,   1005,   1007,   1007,
    1008,   1009,   1010,   1011,   1012,   1013,   1014,   1016,
    1016,   1017,   1019,   1019,   1020,   891,    892,    893
};


uint32_t
LowerCase::lowercase_4_block[256] = {
    1104,   1105,   1106,   1107,   1108,   1109,   1110,   1111,
    1112,   1113,   1114,   1115,   1116,   1117,   1118,   1119,
    1072,   1073,   1074,   1075,   1076,   1077,   1078,   1079,
    1080,   1081,   1082,   1083,   1084,   1085,   1086,   1087,
    1088,   1089,   1090,   1091,   1092,   1093,   1094,   1095,
    1096,   1097,   1098,   1099,   1100,   1101,   1102,   1103,
    1072,   1073,   1074,   1075,   1076,   1077,   1078,   1079,
    1080,   1081,   1082,   1083,   1084,   1085,   1086,   1087,
    1088,   1089,   1090,   1091,   1092,   1093,   1094,   1095,
    1096,   1097,   1098,   1099,   1100,   1101,   1102,   1103,
    1104,   1105,   1106,   1107,   1108,   1109,   1110,   1111,
    1112,   1113,   1114,   1115,   1116,   1117,   1118,   1119,
    1121,   1121,   1123,   1123,   1125,   1125,   1127,   1127,
    1129,   1129,   1131,   1131,   1133,   1133,   1135,   1135,
    1137,   1137,   1139,   1139,   1141,   1141,   1143,   1143,
    1145,   1145,   1147,   1147,   1149,   1149,   1151,   1151,
    1153,   1153,   1154,   1155,   1156,   1157,   1158,   1159,
    1160,   1161,   1163,   1163,   1165,   1165,   1167,   1167,
    1169,   1169,   1171,   1171,   1173,   1173,   1175,   1175,
    1177,   1177,   1179,   1179,   1181,   1181,   1183,   1183,
    1185,   1185,   1187,   1187,   1189,   1189,   1191,   1191,
    1193,   1193,   1195,   1195,   1197,   1197,   1199,   1199,
    1201,   1201,   1203,   1203,   1205,   1205,   1207,   1207,
    1209,   1209,   1211,   1211,   1213,   1213,   1215,   1215,
    1231,   1218,   1218,   1220,   1220,   1222,   1222,   1224,
    1224,   1226,   1226,   1228,   1228,   1230,   1230,   1231,
    1233,   1233,   1235,   1235,   1237,   1237,   1239,   1239,
    1241,   1241,   1243,   1243,   1245,   1245,   1247,   1247,
    1249,   1249,   1251,   1251,   1253,   1253,   1255,   1255,
    1257,   1257,   1259,   1259,   1261,   1261,   1263,   1263,
    1265,   1265,   1267,   1267,   1269,   1269,   1271,   1271,
    1273,   1273,   1275,   1275,   1277,   1277,   1279,   1279
};


uint32_t
LowerCase::lowercase_5_block[256] = {
    1281,   1281,   1283,   1283,   1285,   1285,   1287,   1287,
    1289,   1289,   1291,   1291,   1293,   1293,   1295,   1295,
    1297,   1297,   1299,   1299,   1300,   1301,   1302,   1303,
    1304,   1305,   1306,   1307,   1308,   1309,   1310,   1311,
    1312,   1313,   1314,   1315,   1316,   1317,   1318,   1319,
    1320,   1321,   1322,   1323,   1324,   1325,   1326,   1327,
    1328,   1377,   1378,   1379,   1380,   1381,   1382,   1383,
    1384,   1385,   1386,   1387,   1388,   1389,   1390,   1391,
    1392,   1393,   1394,   1395,   1396,   1397,   1398,   1399,
    1400,   1401,   1402,   1403,   1404,   1405,   1406,   1407,
    1408,   1409,   1410,   1411,   1412,   1413,   1414,   1367,
    1368,   1369,   1370,   1371,   1372,   1373,   1374,   1375,
    1376,   1377,   1378,   1379,   1380,   1381,   1382,   1383,
    1384,   1385,   1386,   1387,   1388,   1389,   1390,   1391,
    1392,   1393,   1394,   1395,   1396,   1397,   1398,   1399,
    1400,   1401,   1402,   1403,   1404,   1405,   1406,   1407,
    1408,   1409,   1410,   1411,   1412,   1413,   1414,   1415,
    1416,   1417,   1418,   1419,   1420,   1421,   1422,   1423,
    1424,   1425,   1426,   1427,   1428,   1429,   1430,   1431,
    1432,   1433,   1434,   1435,   1436,   1437,   1438,   1439,
    1440,   1441,   1442,   1443,   1444,   1445,   1446,   1447,
    1448,   1449,   1450,   1451,   1452,   1453,   1454,   1455,
    1456,   1457,   1458,   1459,   1460,   1461,   1462,   1463,
    1464,   1465,   1466,   1467,   1468,   1469,   1470,   1471,
    1472,   1473,   1474,   1475,   1476,   1477,   1478,   1479,
    1480,   1481,   1482,   1483,   1484,   1485,   1486,   1487,
    1488,   1489,   1490,   1491,   1492,   1493,   1494,   1495,
    1496,   1497,   1498,   1499,   1500,   1501,   1502,   1503,
    1504,   1505,   1506,   1507,   1508,   1509,   1510,   1511,
    1512,   1513,   1514,   1515,   1516,   1517,   1518,   1519,
    1520,   1521,   1522,   1523,   1524,   1525,   1526,   1527,
    1528,   1529,   1530,   1531,   1532,   1533,   1534,   1535
};


uint32_t
LowerCase::lowercase_16_block[256] = {
    4096,   4097,   4098,   4099,   4100,   4101,   4102,   4103,
    4104,   4105,   4106,   4107,   4108,   4109,   4110,   4111,
    4112,   4113,   4114,   4115,   4116,   4117,   4118,   4119,
    4120,   4121,   4122,   4123,   4124,   4125,   4126,   4127,
    4128,   4129,   4130,   4131,   4132,   4133,   4134,   4135,
    4136,   4137,   4138,   4139,   4140,   4141,   4142,   4143,
    4144,   4145,   4146,   4147,   4148,   4149,   4150,   4151,
    4152,   4153,   4154,   4155,   4156,   4157,   4158,   4159,
    4160,   4161,   4162,   4163,   4164,   4165,   4166,   4167,
    4168,   4169,   4170,   4171,   4172,   4173,   4174,   4175,
    4176,   4177,   4178,   4179,   4180,   4181,   4182,   4183,
    4184,   4185,   4186,   4187,   4188,   4189,   4190,   4191,
    4192,   4193,   4194,   4195,   4196,   4197,   4198,   4199,
    4200,   4201,   4202,   4203,   4204,   4205,   4206,   4207,
    4208,   4209,   4210,   4211,   4212,   4213,   4214,   4215,
    4216,   4217,   4218,   4219,   4220,   4221,   4222,   4223,
    4224,   4225,   4226,   4227,   4228,   4229,   4230,   4231,
    4232,   4233,   4234,   4235,   4236,   4237,   4238,   4239,
    4240,   4241,   4242,   4243,   4244,   4245,   4246,   4247,
    4248,   4249,   4250,   4251,   4252,   4253,   4254,   4255,
    11520,  11521,  11522,  11523,  11524,  11525,  11526,  11527,
    11528,  11529,  11530,  11531,  11532,  11533,  11534,  11535,
    11536,  11537,  11538,  11539,  11540,  11541,  11542,  11543,
    11544,  11545,  11546,  11547,  11548,  11549,  11550,  11551,
    11552,  11553,  11554,  11555,  11556,  11557,  4294,   4295,
    4296,   4297,   4298,   4299,   4300,   4301,   4302,   4303,
    4304,   4305,   4306,   4307,   4308,   4309,   4310,   4311,
    4312,   4313,   4314,   4315,   4316,   4317,   4318,   4319,
    4320,   4321,   4322,   4323,   4324,   4325,   4326,   4327,
    4328,   4329,   4330,   4331,   4332,   4333,   4334,   4335,
    4336,   4337,   4338,   4339,   4340,   4341,   4342,   4343,
    4344,   4345,   4346,   4347,   4348,   4349,   4350,   4351
};


uint32_t
LowerCase::lowercase_30_block[256] = {
    7681,   7681,   7683,   7683,   7685,   7685,   7687,   7687,
    7689,   7689,   7691,   7691,   7693,   7693,   7695,   7695,
    7697,   7697,   7699,   7699,   7701,   7701,   7703,   7703,
    7705,   7705,   7707,   7707,   7709,   7709,   7711,   7711,
    7713,   7713,   7715,   7715,   7717,   7717,   7719,   7719,
    7721,   7721,   7723,   7723,   7725,   7725,   7727,   7727,
    7729,   7729,   7731,   7731,   7733,   7733,   7735,   7735,
    7737,   7737,   7739,   7739,   7741,   7741,   7743,   7743,
    7745,   7745,   7747,   7747,   7749,   7749,   7751,   7751,
    7753,   7753,   7755,   7755,   7757,   7757,   7759,   7759,
    7761,   7761,   7763,   7763,   7765,   7765,   7767,   7767,
    7769,   7769,   7771,   7771,   7773,   7773,   7775,   7775,
    7777,   7777,   7779,   7779,   7781,   7781,   7783,   7783,
    7785,   7785,   7787,   7787,   7789,   7789,   7791,   7791,
    7793,   7793,   7795,   7795,   7797,   7797,   7799,   7799,
    7801,   7801,   7803,   7803,   7805,   7805,   7807,   7807,
    7809,   7809,   7811,   7811,   7813,   7813,   7815,   7815,
    7817,   7817,   7819,   7819,   7821,   7821,   7823,   7823,
    7825,   7825,   7827,   7827,   7829,   7829,   7830,   7831,
    7832,   7833,   7834,   7835,   7836,   7837,   7838,   7839,
    7841,   7841,   7843,   7843,   7845,   7845,   7847,   7847,
    7849,   7849,   7851,   7851,   7853,   7853,   7855,   7855,
    7857,   7857,   7859,   7859,   7861,   7861,   7863,   7863,
    7865,   7865,   7867,   7867,   7869,   7869,   7871,   7871,
    7873,   7873,   7875,   7875,   7877,   7877,   7879,   7879,
    7881,   7881,   7883,   7883,   7885,   7885,   7887,   7887,
    7889,   7889,   7891,   7891,   7893,   7893,   7895,   7895,
    7897,   7897,   7899,   7899,   7901,   7901,   7903,   7903,
    7905,   7905,   7907,   7907,   7909,   7909,   7911,   7911,
    7913,   7913,   7915,   7915,   7917,   7917,   7919,   7919,
    7921,   7921,   7923,   7923,   7925,   7925,   7927,   7927,
    7929,   7929,   7930,   7931,   7932,   7933,   7934,   7935
};


uint32_t
LowerCase::lowercase_31_block[256] = {
    7936,   7937,   7938,   7939,   7940,   7941,   7942,   7943,
    7936,   7937,   7938,   7939,   7940,   7941,   7942,   7943,
    7952,   7953,   7954,   7955,   7956,   7957,   7958,   7959,
    7952,   7953,   7954,   7955,   7956,   7957,   7966,   7967,
    7968,   7969,   7970,   7971,   7972,   7973,   7974,   7975,
    7968,   7969,   7970,   7971,   7972,   7973,   7974,   7975,
    7984,   7985,   7986,   7987,   7988,   7989,   7990,   7991,
    7984,   7985,   7986,   7987,   7988,   7989,   7990,   7991,
    8000,   8001,   8002,   8003,   8004,   8005,   8006,   8007,
    8000,   8001,   8002,   8003,   8004,   8005,   8014,   8015,
    8016,   8017,   8018,   8019,   8020,   8021,   8022,   8023,
    8024,   8017,   8026,   8019,   8028,   8021,   8030,   8023,
    8032,   8033,   8034,   8035,   8036,   8037,   8038,   8039,
    8032,   8033,   8034,   8035,   8036,   8037,   8038,   8039,
    8048,   8049,   8050,   8051,   8052,   8053,   8054,   8055,
    8056,   8057,   8058,   8059,   8060,   8061,   8062,   8063,
    8064,   8065,   8066,   8067,   8068,   8069,   8070,   8071,
    8064,   8065,   8066,   8067,   8068,   8069,   8070,   8071,
    8080,   8081,   8082,   8083,   8084,   8085,   8086,   8087,
    8080,   8081,   8082,   8083,   8084,   8085,   8086,   8087,
    8096,   8097,   8098,   8099,   8100,   8101,   8102,   8103,
    8096,   8097,   8098,   8099,   8100,   8101,   8102,   8103,
    8112,   8113,   8114,   8115,   8116,   8117,   8118,   8119,
    8112,   8113,   8048,   8123,   8115,   8125,   8126,   8127,
    8128,   8129,   8130,   8131,   8132,   8133,   8134,   8135,
    8050,   8137,   8052,   8139,   8131,   8141,   8142,   8143,
    8144,   8145,   8146,   8147,   8148,   8149,   8150,   8151,
    8144,   8145,   8054,   8155,   8156,   8157,   8158,   8159,
    8160,   8161,   8162,   8163,   8164,   8165,   8166,   8167,
    8160,   8161,   8058,   8171,   8165,   8173,   8174,   8175,
    8176,   8177,   8178,   8179,   8180,   8181,   8182,   8183,
    8056,   8185,   8060,   8187,   8179,   8189,   8190,   8191
};


uint32_t
LowerCase::lowercase_33_block[256] = {
    8448,   8449,   8450,   8451,   8452,   8453,   8454,   8455,
    8456,   8457,   8458,   8459,   8460,   8461,   8462,   8463,
    8464,   8465,   8466,   8467,   8468,   8469,   8470,   8471,
    8472,   8473,   8474,   8475,   8476,   8477,   8478,   8479,
    8480,   8481,   8482,   8483,   8484,   8485,   8486,   8487,
    8488,   8489,   8490,   8491,   8492,   8493,   8494,   8495,
    8496,   8497,   8526,   8499,   8500,   8501,   8502,   8503,
    8504,   8505,   8506,   8507,   8508,   8509,   8510,   8511,
    8512,   8513,   8514,   8515,   8516,   8517,   8518,   8519,
    8520,   8521,   8522,   8523,   8524,   8525,   8526,   8527,
    8528,   8529,   8530,   8531,   8532,   8533,   8534,   8535,
    8536,   8537,   8538,   8539,   8540,   8541,   8542,   8543,
    8544,   8545,   8546,   8547,   8548,   8549,   8550,   8551,
    8552,   8553,   8554,   8555,   8556,   8557,   8558,   8559,
    8560,   8561,   8562,   8563,   8564,   8565,   8566,   8567,
    8568,   8569,   8570,   8571,   8572,   8573,   8574,   8575,
    8576,   8577,   8578,   8580,   8580,   8581,   8582,   8583,
    8584,   8585,   8586,   8587,   8588,   8589,   8590,   8591,
    8592,   8593,   8594,   8595,   8596,   8597,   8598,   8599,
    8600,   8601,   8602,   8603,   8604,   8605,   8606,   8607,
    8608,   8609,   8610,   8611,   8612,   8613,   8614,   8615,
    8616,   8617,   8618,   8619,   8620,   8621,   8622,   8623,
    8624,   8625,   8626,   8627,   8628,   8629,   8630,   8631,
    8632,   8633,   8634,   8635,   8636,   8637,   8638,   8639,
    8640,   8641,   8642,   8643,   8644,   8645,   8646,   8647,
    8648,   8649,   8650,   8651,   8652,   8653,   8654,   8655,
    8656,   8657,   8658,   8659,   8660,   8661,   8662,   8663,
    8664,   8665,   8666,   8667,   8668,   8669,   8670,   8671,
    8672,   8673,   8674,   8675,   8676,   8677,   8678,   8679,
    8680,   8681,   8682,   8683,   8684,   8685,   8686,   8687,
    8688,   8689,   8690,   8691,   8692,   8693,   8694,   8695,
    8696,   8697,   8698,   8699,   8700,   8701,   8702,   8703
};


uint32_t
LowerCase::lowercase_44_block[256] = {
    11312,  11313,  11314,  11315,  11316,  11317,  11318,  11319,
    11320,  11321,  11322,  11323,  11324,  11325,  11326,  11327,
    11328,  11329,  11330,  11331,  11332,  11333,  11334,  11335,
    11336,  11337,  11338,  11339,  11340,  11341,  11342,  11343,
    11344,  11345,  11346,  11347,  11348,  11349,  11350,  11351,
    11352,  11353,  11354,  11355,  11356,  11357,  11358,  11311,
    11312,  11313,  11314,  11315,  11316,  11317,  11318,  11319,
    11320,  11321,  11322,  11323,  11324,  11325,  11326,  11327,
    11328,  11329,  11330,  11331,  11332,  11333,  11334,  11335,
    11336,  11337,  11338,  11339,  11340,  11341,  11342,  11343,
    11344,  11345,  11346,  11347,  11348,  11349,  11350,  11351,
    11352,  11353,  11354,  11355,  11356,  11357,  11358,  11359,
    11361,  11361,  619,    7549,   637,    11365,  11366,  11368,
    11368,  11370,  11370,  11372,  11372,  11373,  11374,  11375,
    11376,  11377,  11378,  11379,  11380,  11382,  11382,  11383,
    11384,  11385,  11386,  11387,  11388,  11389,  11390,  11391,
    11393,  11393,  11395,  11395,  11397,  11397,  11399,  11399,
    11401,  11401,  11403,  11403,  11405,  11405,  11407,  11407,
    11409,  11409,  11411,  11411,  11413,  11413,  11415,  11415,
    11417,  11417,  11419,  11419,  11421,  11421,  11423,  11423,
    11425,  11425,  11427,  11427,  11429,  11429,  11431,  11431,
    11433,  11433,  11435,  11435,  11437,  11437,  11439,  11439,
    11441,  11441,  11443,  11443,  11445,  11445,  11447,  11447,
    11449,  11449,  11451,  11451,  11453,  11453,  11455,  11455,
    11457,  11457,  11459,  11459,  11461,  11461,  11463,  11463,
    11465,  11465,  11467,  11467,  11469,  11469,  11471,  11471,
    11473,  11473,  11475,  11475,  11477,  11477,  11479,  11479,
    11481,  11481,  11483,  11483,  11485,  11485,  11487,  11487,
    11489,  11489,  11491,  11491,  11492,  11493,  11494,  11495,
    11496,  11497,  11498,  11499,  11500,  11501,  11502,  11503,
    11504,  11505,  11506,  11507,  11508,  11509,  11510,  11511,
    11512,  11513,  11514,  11515,  11516,  11517,  11518,  11519
};


uint32_t
LowerCase::lowercase_260_block[256] = {
    66600,  66601,  66602,  66603,  66604,  66605,  66606,  66607,
    66608,  66609,  66610,  66611,  66612,  66613,  66614,  66615,
    66616,  66617,  66618,  66619,  66620,  66621,  66622,  66623,
    66624,  66625,  66626,  66627,  66628,  66629,  66630,  66631,
    66632,  66633,  66634,  66635,  66636,  66637,  66638,  66639,
    66600,  66601,  66602,  66603,  66604,  66605,  66606,  66607,
    66608,  66609,  66610,  66611,  66612,  66613,  66614,  66615,
    66616,  66617,  66618,  66619,  66620,  66621,  66622,  66623,
    66624,  66625,  66626,  66627,  66628,  66629,  66630,  66631,
    66632,  66633,  66634,  66635,  66636,  66637,  66638,  66639,
    66640,  66641,  66642,  66643,  66644,  66645,  66646,  66647,
    66648,  66649,  66650,  66651,  66652,  66653,  66654,  66655,
    66656,  66657,  66658,  66659,  66660,  66661,  66662,  66663,
    66664,  66665,  66666,  66667,  66668,  66669,  66670,  66671,
    66672,  66673,  66674,  66675,  66676,  66677,  66678,  66679,
    66680,  66681,  66682,  66683,  66684,  66685,  66686,  66687,
    66688,  66689,  66690,  66691,  66692,  66693,  66694,  66695,
    66696,  66697,  66698,  66699,  66700,  66701,  66702,  66703,
    66704,  66705,  66706,  66707,  66708,  66709,  66710,  66711,
    66712,  66713,  66714,  66715,  66716,  66717,  66718,  66719,
    66720,  66721,  66722,  66723,  66724,  66725,  66726,  66727,
    66728,  66729,  66730,  66731,  66732,  66733,  66734,  66735,
    66736,  66737,  66738,  66739,  66740,  66741,  66742,  66743,
    66744,  66745,  66746,  66747,  66748,  66749,  66750,  66751,
    66752,  66753,  66754,  66755,  66756,  66757,  66758,  66759,
    66760,  66761,  66762,  66763,  66764,  66765,  66766,  66767,
    66768,  66769,  66770,  66771,  66772,  66773,  66774,  66775,
    66776,  66777,  66778,  66779,  66780,  66781,  66782,  66783,
    66784,  66785,  66786,  66787,  66788,  66789,  66790,  66791,
    66792,  66793,  66794,  66795,  66796,  66797,  66798,  66799,
    66800,  66801,  66802,  66803,  66804,  66805,  66806,  66807,
    66808,  66809,  66810,  66811,  66812,  66813,  66814,  66815
};

// special performance hack:
// concatenation of blocks 0,1,2,3,4,5

uint32_t
LowerCase::lowercase_0_5_blocks[0x600] = {
    0,      1,      2,      3,      4,      5,      6,      7,
    8,      9,      10,     11,     12,     13,     14,     15,
    16,     17,     18,     19,     20,     21,     22,     23,
    24,     25,     26,     27,     28,     29,     30,     31,
    32,     33,     34,     35,     36,     37,     38,     39,
    40,     41,     42,     43,     44,     45,     46,     47,
    48,     49,     50,     51,     52,     53,     54,     55,
    56,     57,     58,     59,     60,     61,     62,     63,
    64,     97,     98,     99,     100,    101,    102,    103,
    104,    105,    106,    107,    108,    109,    110,    111,
    112,    113,    114,    115,    116,    117,    118,    119,
    120,    121,    122,    91,     92,     93,     94,     95,
    96,     97,     98,     99,     100,    101,    102,    103,
    104,    105,    106,    107,    108,    109,    110,    111,
    112,    113,    114,    115,    116,    117,    118,    119,
    120,    121,    122,    123,    124,    125,    126,    127,
    128,    129,    130,    131,    132,    133,    134,    135,
    136,    137,    138,    139,    140,    141,    142,    143,
    144,    145,    146,    147,    148,    149,    150,    151,
    152,    153,    154,    155,    156,    157,    158,    159,
    160,    161,    162,    163,    164,    165,    166,    167,
    168,    169,    170,    171,    172,    173,    174,    175,
    176,    177,    178,    179,    180,    181,    182,    183,
    184,    185,    186,    187,    188,    189,    190,    191,
    224,    225,    226,    227,    228,    229,    230,    231,
    232,    233,    234,    235,    236,    237,    238,    239,
    240,    241,    242,    243,    244,    245,    246,    215,
    248,    249,    250,    251,    252,    253,    254,    223,
    224,    225,    226,    227,    228,    229,    230,    231,
    232,    233,    234,    235,    236,    237,    238,    239,
    240,    241,    242,    243,    244,    245,    246,    247,
    248,    249,    250,    251,    252,    253,    254,    255,
    257,    257,    259,    259,    261,    261,    263,    263,
    265,    265,    267,    267,    269,    269,    271,    271,
    273,    273,    275,    275,    277,    277,    279,    279,
    281,    281,    283,    283,    285,    285,    287,    287,
    289,    289,    291,    291,    293,    293,    295,    295,
    297,    297,    299,    299,    301,    301,    303,    303,
    105,    305,    306,    307,    309,    309,    311,    311,
    312,    314,    314,    316,    316,    318,    318,    319,
    320,    322,    322,    324,    324,    326,    326,    328,
    328,    329,    331,    331,    333,    333,    335,    335,
    337,    337,    339,    339,    341,    341,    343,    343,
    345,    345,    347,    347,    349,    349,    351,    351,
    353,    353,    355,    355,    357,    357,    359,    359,
    361,    361,    363,    363,    365,    365,    367,    367,
    369,    369,    371,    371,    373,    373,    375,    375,
    255,    378,    378,    380,    380,    382,    382,    383,
    384,    595,    387,    387,    389,    389,    596,    392,
    392,    598,    599,    396,    396,    397,    477,    601,
    603,    402,    402,    608,    611,    405,    617,    616,
    409,    409,    410,    411,    623,    626,    414,    629,
    417,    417,    419,    419,    421,    421,    640,    424,
    424,    643,    426,    427,    429,    429,    648,    432,
    432,    650,    651,    436,    436,    438,    438,    658,
    441,    441,    442,    443,    445,    445,    446,    447,
    448,    449,    450,    451,    452,    453,    454,    455,
    456,    457,    458,    459,    460,    462,    462,    464,
    464,    466,    466,    468,    468,    470,    470,    472,
    472,    474,    474,    476,    476,    477,    479,    479,
    481,    481,    483,    483,    485,    485,    487,    487,
    489,    489,    491,    491,    493,    493,    495,    495,
    496,    497,    498,    499,    501,    501,    405,    447,
    505,    505,    507,    507,    509,    509,    511,    511,
    513,    513,    515,    515,    517,    517,    519,    519,
    521,    521,    523,    523,    525,    525,    527,    527,
    529,    529,    531,    531,    533,    533,    535,    535,
    537,    537,    539,    539,    541,    541,    543,    543,
    414,    545,    547,    547,    549,    549,    551,    551,
    553,    553,    555,    555,    557,    557,    559,    559,
    561,    561,    563,    563,    564,    565,    566,    567,
    568,    569,    11365,  572,    572,    410,    11366,  575,
    576,    578,    578,    384,    649,    652,    583,    583,
    585,    585,    587,    587,    589,    589,    591,    591,
    592,    593,    594,    595,    596,    597,    598,    599,
    600,    601,    602,    603,    604,    605,    606,    607,
    608,    609,    610,    611,    612,    613,    614,    615,
    616,    617,    618,    619,    620,    621,    622,    623,
    624,    625,    626,    627,    628,    629,    630,    631,
    632,    633,    634,    635,    636,    637,    638,    639,
    640,    641,    642,    643,    644,    645,    646,    647,
    648,    649,    650,    651,    652,    653,    654,    655,
    656,    657,    658,    659,    660,    661,    662,    663,
    664,    665,    666,    667,    668,    669,    670,    671,
    672,    673,    674,    675,    676,    677,    678,    679,
    680,    681,    682,    683,    684,    685,    686,    687,
    688,    689,    690,    691,    692,    693,    694,    695,
    696,    697,    698,    699,    700,    701,    702,    703,
    704,    705,    706,    707,    708,    709,    710,    711,
    712,    713,    714,    715,    716,    717,    718,    719,
    720,    721,    722,    723,    724,    725,    726,    727,
    728,    729,    730,    731,    732,    733,    734,    735,
    736,    737,    738,    739,    740,    741,    742,    743,
    744,    745,    746,    747,    748,    749,    750,    751,
    752,    753,    754,    755,    756,    757,    758,    759,
    760,    761,    762,    763,    764,    765,    766,    767,
    768,    769,    770,    771,    772,    773,    774,    775,
    776,    777,    778,    779,    780,    781,    782,    783,
    784,    785,    786,    787,    788,    789,    790,    791,
    792,    793,    794,    795,    796,    797,    798,    799,
    800,    801,    802,    803,    804,    805,    806,    807,
    808,    809,    810,    811,    812,    813,    814,    815,
    816,    817,    818,    819,    820,    821,    822,    823,
    824,    825,    826,    827,    828,    829,    830,    831,
    832,    833,    834,    835,    836,    837,    838,    839,
    840,    841,    842,    843,    844,    845,    846,    847,
    848,    849,    850,    851,    852,    853,    854,    855,
    856,    857,    858,    859,    860,    861,    862,    863,
    864,    865,    866,    867,    868,    869,    870,    871,
    872,    873,    874,    875,    876,    877,    878,    879,
    880,    881,    882,    883,    884,    885,    886,    887,
    888,    889,    890,    891,    892,    893,    894,    895,
    896,    897,    898,    899,    900,    901,    940,    903,
    941,    942,    943,    907,    972,    909,    973,    974,
    912,    945,    946,    947,    948,    949,    950,    951,
    952,    953,    954,    955,    956,    957,    958,    959,
    960,    961,    930,    963,    964,    965,    966,    967,
    968,    969,    970,    971,    940,    941,    942,    943,
    944,    945,    946,    947,    948,    949,    950,    951,
    952,    953,    954,    955,    956,    957,    958,    959,
    960,    961,    962,    963,    964,    965,    966,    967,
    968,    969,    970,    971,    972,    973,    974,    975,
    976,    977,    978,    979,    980,    981,    982,    983,
    985,    985,    987,    987,    989,    989,    991,    991,
    993,    993,    995,    995,    997,    997,    999,    999,
    1001,   1001,   1003,   1003,   1005,   1005,   1007,   1007,
    1008,   1009,   1010,   1011,   1012,   1013,   1014,   1016,
    1016,   1017,   1019,   1019,   1020,   891,    892,    893,
    1104,   1105,   1106,   1107,   1108,   1109,   1110,   1111,
    1112,   1113,   1114,   1115,   1116,   1117,   1118,   1119,
    1072,   1073,   1074,   1075,   1076,   1077,   1078,   1079,
    1080,   1081,   1082,   1083,   1084,   1085,   1086,   1087,
    1088,   1089,   1090,   1091,   1092,   1093,   1094,   1095,
    1096,   1097,   1098,   1099,   1100,   1101,   1102,   1103,
    1072,   1073,   1074,   1075,   1076,   1077,   1078,   1079,
    1080,   1081,   1082,   1083,   1084,   1085,   1086,   1087,
    1088,   1089,   1090,   1091,   1092,   1093,   1094,   1095,
    1096,   1097,   1098,   1099,   1100,   1101,   1102,   1103,
    1104,   1105,   1106,   1107,   1108,   1109,   1110,   1111,
    1112,   1113,   1114,   1115,   1116,   1117,   1118,   1119,
    1121,   1121,   1123,   1123,   1125,   1125,   1127,   1127,
    1129,   1129,   1131,   1131,   1133,   1133,   1135,   1135,
    1137,   1137,   1139,   1139,   1141,   1141,   1143,   1143,
    1145,   1145,   1147,   1147,   1149,   1149,   1151,   1151,
    1153,   1153,   1154,   1155,   1156,   1157,   1158,   1159,
    1160,   1161,   1163,   1163,   1165,   1165,   1167,   1167,
    1169,   1169,   1171,   1171,   1173,   1173,   1175,   1175,
    1177,   1177,   1179,   1179,   1181,   1181,   1183,   1183,
    1185,   1185,   1187,   1187,   1189,   1189,   1191,   1191,
    1193,   1193,   1195,   1195,   1197,   1197,   1199,   1199,
    1201,   1201,   1203,   1203,   1205,   1205,   1207,   1207,
    1209,   1209,   1211,   1211,   1213,   1213,   1215,   1215,
    1231,   1218,   1218,   1220,   1220,   1222,   1222,   1224,
    1224,   1226,   1226,   1228,   1228,   1230,   1230,   1231,
    1233,   1233,   1235,   1235,   1237,   1237,   1239,   1239,
    1241,   1241,   1243,   1243,   1245,   1245,   1247,   1247,
    1249,   1249,   1251,   1251,   1253,   1253,   1255,   1255,
    1257,   1257,   1259,   1259,   1261,   1261,   1263,   1263,
    1265,   1265,   1267,   1267,   1269,   1269,   1271,   1271,
    1273,   1273,   1275,   1275,   1277,   1277,   1279,   1279,
    1281,   1281,   1283,   1283,   1285,   1285,   1287,   1287,
    1289,   1289,   1291,   1291,   1293,   1293,   1295,   1295,
    1297,   1297,   1299,   1299,   1300,   1301,   1302,   1303,
    1304,   1305,   1306,   1307,   1308,   1309,   1310,   1311,
    1312,   1313,   1314,   1315,   1316,   1317,   1318,   1319,
    1320,   1321,   1322,   1323,   1324,   1325,   1326,   1327,
    1328,   1377,   1378,   1379,   1380,   1381,   1382,   1383,
    1384,   1385,   1386,   1387,   1388,   1389,   1390,   1391,
    1392,   1393,   1394,   1395,   1396,   1397,   1398,   1399,
    1400,   1401,   1402,   1403,   1404,   1405,   1406,   1407,
    1408,   1409,   1410,   1411,   1412,   1413,   1414,   1367,
    1368,   1369,   1370,   1371,   1372,   1373,   1374,   1375,
    1376,   1377,   1378,   1379,   1380,   1381,   1382,   1383,
    1384,   1385,   1386,   1387,   1388,   1389,   1390,   1391,
    1392,   1393,   1394,   1395,   1396,   1397,   1398,   1399,
    1400,   1401,   1402,   1403,   1404,   1405,   1406,   1407,
    1408,   1409,   1410,   1411,   1412,   1413,   1414,   1415,
    1416,   1417,   1418,   1419,   1420,   1421,   1422,   1423,
    1424,   1425,   1426,   1427,   1428,   1429,   1430,   1431,
    1432,   1433,   1434,   1435,   1436,   1437,   1438,   1439,
    1440,   1441,   1442,   1443,   1444,   1445,   1446,   1447,
    1448,   1449,   1450,   1451,   1452,   1453,   1454,   1455,
    1456,   1457,   1458,   1459,   1460,   1461,   1462,   1463,
    1464,   1465,   1466,   1467,   1468,   1469,   1470,   1471,
    1472,   1473,   1474,   1475,   1476,   1477,   1478,   1479,
    1480,   1481,   1482,   1483,   1484,   1485,   1486,   1487,
    1488,   1489,   1490,   1491,   1492,   1493,   1494,   1495,
    1496,   1497,   1498,   1499,   1500,   1501,   1502,   1503,
    1504,   1505,   1506,   1507,   1508,   1509,   1510,   1511,
    1512,   1513,   1514,   1515,   1516,   1517,   1518,   1519,
    1520,   1521,   1522,   1523,   1524,   1525,   1526,   1527,
    1528,   1529,   1530,   1531,   1532,   1533,   1534,   1535
};


} // namespace vespalib
